package ex1;



/**
 * Sheet 3, exercise 1
 * class to serialize a class.
 * 
 * @author Dennis Meyer, Sebastian Brodehl, Sebastian Schappert
 * @version 1.0.0.0
 *
 */

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class SerializeClass {
	/**
	 * method to serialize a class using ObjectOutputStream
	 * @param classname, name of the class to be serialized
	 * @return .ser file with serialized class
	 */
	public void serialize(String classname) {
		
		try {
			FileOutputStream fileout = new FileOutputStream(
					classname + ".ser");
			ObjectOutputStream out = new ObjectOutputStream(fileout);
			out.writeObject(this.getClass());
			out.close();
			fileout.close();
		} catch (IOException e) {
			System.out.println("Error: " + e.getMessage());
			return;
		}
	}
}
